<?php
/**
 * Created by PhpStorm.
 * User: xujiang
 * Date: 2017/9/9
 * Time: 15:39
 */

$aa = "aa";
const  N = "bb";
 class A{
     protected $kk = "dfsgd";

     private static $in;
     function __construct($kk)
     {
         $this->kk = $kk;
     }

     static function getin($kk){
         if(self::$in){
             return self::$in;
         }
         self::$in = new A($kk);
         return self::$in;
     }

     function printm(){
         echo $this->kk;
     }
 }

 function run($aa){
     $aaa = A::getin($aa);
     $aaa->printm();
     sleep(10);
     $aaa->printm();
     sleep(10);
     $aaa->printm();
     sleep(10);
     $aaa->printm();
     sleep(10);
     $aaa->printm();
     sleep(10);
     $aaa->printm();
     sleep(10);
     $aaa->printm();
     sleep(10);
 }

 run("bbbb");

